<?php
/**
* @version   $Id: scribblemap.php 4 2010-10-05 09:23:50Z edo888 $
* @package   Scribble Maps
* @copyright Copyright (C) 2010 Edvard Ananyan. All rights reserved.
* @license   GNU/GPL, see LICENSE.php
*/

defined('_JEXEC') or die('Restricted access');

class JElementScribbleMap extends JElement {
    var $_name = 'ScribbleMap';

    function fetchElement($name, $value, &$node, $control_name) {
        $db = &JFactory::getDBO();
        $query = 'SELECT id, title FROM #__scribblemaps ORDER BY title';
        $db->setQuery($query);
        $options = $db->loadObjectList();
        array_unshift($options, JHTML::_('select.option', '0', '- '.JText::_('Select Map').' -', 'id', 'title'));

        return JHTML::_('select.genericlist',  $options, ''.$control_name.'['.$name.']', 'class="inputbox"', 'id', 'title', $value, $control_name.$name);
    }
}
